<template>
  <div class="cofirmorder-cell">
    <div class="cofirmorder-cell__item">
      <div class="cofirmorder-cell__item__left">
        <img :src="model.img"
             alt="">
      </div>
      <div class="cofirmorder-cell__item__right">
        <span>{{model.pdname}}</span>
      </div>
    </div>
    <div class="cofirmorder-cell__subsku">
      <cofirmorder-subsku-cell v-for="(item,index) in model.skulist"
                               :index="index"
                               :model="item"
                               :discount="discount"
                               :key="index"></cofirmorder-subsku-cell>
    </div>

  </div>
</template>
<style lang="stylus" scoped>
.cofirmorder-cell {
  padding-bottom: 20px;

  .cofirmorder-cell__item {
    margin: 20px 0;
    padding: 0 20px;
    display: flex;
    justify-content: flex-start;
    flex-direction: row;

    .cofirmorder-cell__item__line {
      padding: 0 20px; // 调整左右距离
      margin: 20px 0; // 调整上下距离
      width: 100%;
    }

    .cofirmorder-cell__item__left {
      position: relative;

      img {
        width: 132px;
        height: 132px;
        vertical-align: middle;
      }

      .cofirmorder-cell__item__left__desc {
        display: flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        width: 100%;
        height: 40px;
        bottom: 0;
        background: rgba(#000000, 0.48);

        span {
          font-size: 22px;
          color: #ffffff;
        }
      }
    }

    .cofirmorder-cell__item__right {
      margin-left: 15px;

      span {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        font-family: PingFangSC-Regular;
        font-size: 26px;
        color: #333333;
        line-height: 36px;
      }
    }
  }
}
</style>
<script>
import cofirmorderSubskuCell from './cofirmorder-subsku-cell'
// import {calc} from '@/_util'
export default {
  name: 'cofirmorder-cell',
  mixins: [],
  data () {
    return {
      totalModel: {}
    }
  },
  props: {
    model: {
      type: Object
    },
    discount: {
      type: Number
    },
    index: {
      type: Number
    }
  },
  mounted () {
    // let numTotal = 0
    // let priceTotal = 0
    // if (this.model && this.model.skulist) {
    //   for (let i = 0; i < this.model.skulist.length; i++) {
    //     let sku = this.model.skulist[i]
    //     numTotal = calc(numTotal).add(sku.detailrnumber).over()
    //     priceTotal = calc(priceTotal).add(sku.detailtotal).over()
    //   }
    // }
    // this.totalModel = {
    //   numTotal: numTotal,
    //   priceTotal: priceTotal,
    //   unit: this.model.skulist[0].pdunit
    // }
  },
  watch: {},
  computed: {
  },
  components: {
    cofirmorderSubskuCell
  },
  methods: {}
}
</script>
